<template>
  <div class="promptBox">
    <div class="tips flex-start">
      <div class="pic">
        <img src="@/assets/prompt.png" alt="" />
      </div>
      <div class="title">是否删除该文档?</div>
    </div>
    <div class="reason flex-start">请选择删除原因</div>

    <div class="content">
      <div class="flex-start">
        <div class="exfw">
          <input
            type="radio"
            id="exfw"
            name="drone"
            value="文件名不合法"
            v-model="checked"
          />
          <label for="exfw">文件名不合法</label>
        </div>
        <div class="wjbhf">
          <input
            type="radio"
            id="wjbhf"
            name="drone"
            value="文件包含病毒"
            v-model="checked"
          />
          <label for="wjbhf">文件包含病毒</label>
        </div>
      </div>

      <div class="flex-start second">
        <div class="nrbhf">
          <input
            type="radio"
            id="nrbhf"
            name="drone"
            value="文件被检测为不合法的可疑文件"
            v-model="checked"
          />
          <label for="nrbhf">文件被检测为不合法的可疑文件</label>
        </div>
        <!-- <div class="bdly">
          <input
            type="radio"
            id="bdly"
            name="drone"
            value="该账号疑似被病毒利用"
            v-model="checked"

          />
          <label for="bdly">该账号疑似被病毒利用</label>
        </div> -->
      </div>

      <div class="flex-start second">
        <div class="else">
          <input
            type="radio"
            id="else"
            name="drone"
            value="其它"
            v-model="checked"
          />
          <label for="else">其它</label>
        </div>
      </div>
    </div>

    <div class="btns flex-end">
      <div class="cancel" @click="cancel">取消</div>
      <div class="determine" @click="confirm" >确定</div>
    </div>
  </div>
</template>
<script>
export default {
  data () {
    return {
      checked: ''
    }
  },
  methods: {
    cancel () {
      this.$emit('cancel')
    },
    confirm () {
      if (this.checked) {
        const fileId = sessionStorage.getItem('fileId')
        const reason = this.checked
        this.$store
          .dispatch('fileManage/deleteFileData', { fileId, reason })
          .then((res) => {
            if (res.code === 200) {
              this.$message.success(res.message)
              this.$store.dispatch('fileManage/getTableData')
            }
          })
          .catch((err) => {
            this.$message({
              type: 'error',
              message: err,
              duration: 1000
            })
          })
        //   this.$store.dispatch('userManage/stopUser', { phone, reason }).then(res => {
        //     if (res.code === 200) {
        //       this.$message.success(res.message)
        //       this.$store.dispatch('userManage/getTableData')
        //     }
        //   }).catch(err => {
        //     this.$message({
        //       type: 'error',
        //       message: err,
        //       duration: 1000
        //     })
        //   })
        //   // console.log(this.checked)
        this.$emit('confirm')
        this.checked = ''
      } else {
        this.$message({
          type: 'error',
          message: '请选择删除原因',
          duration: 1000
        })
      }
    }
  }
}
</script>
<style lang="scss" scoped>
.promptBox {
  line-height: normal;
  width: 410px;
  height: 277px;
  background: #ffffff;
  box-shadow: 0px 2px 8px 0px rgba(24, 33, 56, 0.28);
  border-radius: 8px;
  position: absolute;
  //   overflow: hidden;
  top: -270px;
  left: -195px;

  z-index: 99;
  .tips {
    height: 22px;
    line-height: 22px;
    margin-top: 16px;
    .pic {
      width: 14px;
      height: 14px;
      margin-left: 16px;
      img {
        width: 100%;
        margin-bottom: 4px;
      }
    }
    .title {
      display: inline-block;
      height: 24px;
      margin-left: 8px;
      line-height: 24px;
      font-size: 16px;
      font-weight: 600;
      color: #1b1f35;
    }
  }
  .reason {
    height: 20px;
    padding-left: 40px;
    width: 100%;
    font-size: 14px;
    font-weight: 400;
    color: #c6ccd7;
  }
  .content {
    padding: 0 32px;
    margin-top: 30px;
    .second {
      margin-top: 20px;
    }
    .flex-start {
      height: 22px;
      line-height: 17px;
      // vertical-align: top;
      input {
        vertical-align: top;
        margin-right: 8px;
      }
    }
    .wjbhf {
      margin-left: 66px;
    }
    .bdly {
      margin-left: 20px;
    }
  }

  .btns {
    margin-top: 30px;
    padding-right: 20px;
    .cancel {
      margin-left: 208px;
      width: 66px;
      text-align: center;
      line-height: 32px;
      height: 32px;
      opacity: 1;
      background: #ffffff;
      border: 1px solid #c6ccd7;
      border-radius: 5px;
    }
    .determine {
      margin-left: 8px;
      width: 66px;
      height: 32px;
      opacity: 1;
      background: #304eec;
      border-radius: 4px;
      text-align: center;
      line-height: 32px;
      color: #fff;
    }
  }
  &::after {
    display: inline-block;
    content: "";
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-top: 8px solid #fff;
    position: absolute;
    bottom: -16px;
    right: 16px;
  }
}
</style>
